package heman.server.temp;

import ks.framework.common.Message;
import ks.framework.communicator.Communicator;
import ks.framework.interfaces.IAuthorization;
import java.util.ArrayList;

public class temp_Authorization implements IAuthorization{
	private ArrayList<String> Name=new ArrayList<String>();
	private ArrayList<String> Password=new ArrayList<String>();
	private int ctr=10000;
	
	public boolean authorize(String who, String pwd) throws Exception{
		for(int i=0;i<Name.size();i++){
			if(Name.get(i).equals(who)&&Password.get(i).equals(pwd))
				return true;
		}
		return false;
	}
	public String selfRegister(String password){
		ctr++;
		Name.add("" + ctr);
		Password.add(""+password);
		return "" + ctr;
	}
	public void login (Communicator com, Message m){
		System.out.println(m.getOriginator() + " has logged in");
	}
	public void logout (Communicator com, Message m){
		System.out.println(m.getOriginator() + " has logged out");
	}
}
